import 'package:car_map/mode/navigation_model.dart';
import 'package:car_map/mode/spuare_type_mode.dart';
import 'package:car_map/page/res/gaps.dart';
import 'package:car_map/page/res/styles.dart';
import 'package:car_map/widget/load_image.dart';
import 'package:car_map/widget/widget_attractions_typetitle.dart';
import 'package:car_map/widget/widget_city_inspiration.dart';
import 'package:car_map/widget/widget_experience_list.dart';
import 'package:car_map/widget/widget_question_item.dart';
import 'package:car_map/widget/widget_swiper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///景点
class AttractionsPage extends StatefulWidget {
  @override
  _attractionsState createState() => _attractionsState();
}

class _attractionsState extends State<AttractionsPage> {
  List sumspuareList;
  List<SpuareTypeModel> spuareCityList;
  List<NavigationModel> navigationList;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    sumspuareList = new List();
    classificationList0();
    classificationList1();
    classificationList2();
    getspuareCityList();
    getNavigationList();

  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('景点'),
      ),
      body: Container(
        child: ListView(
          children: <Widget>[
            widgetHeader(),
            WidgetSwiper(
              sumspuareList: sumspuareList,
            ),
            WidgetCityInspiration(spuareCityList:spuareCityList ,),
            WidgetQuestionItem(),
            Container(
              margin: EdgeInsets.only(top: 10.0,bottom: 10.0,left: 10.0),
              child: Text(
                '当地必体验',
                style: TextStyles.textBold30,
              ),
            ),
            WidgetAttractionsTypetitle(navigationList: navigationList,),
            WidgetExperienceList(),
          ],
        ),
      ),
    );
  }

  //分类集合
  List<SpuareTypeModel> classificationList0() {
    List<SpuareTypeModel> spuareList = new List();
    spuareList.add(new SpuareTypeModel(
        title: '景点',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '酒店',
        urlPath: 'statistics/destination_map_search_result_type_hotel',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '瓜分亿元', urlPath: 'statistics/ic_red_pack', currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '机票', urlPath: 'statistics/ic_air_tickets', currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '问答', urlPath: 'statistics/ic_question', currentIndex: 0));

    sumspuareList.add(spuareList);
  }

  //分类集合
  List<SpuareTypeModel> classificationList1() {
    List<SpuareTypeModel> spuareList = new List();
    spuareList.add(new SpuareTypeModel(
        title: '热门玩法',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '用车',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '游记',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '当地玩乐',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '购物',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    sumspuareList.add(spuareList);
  }

  //分类集合
  List<SpuareTypeModel> classificationList2() {
    List<SpuareTypeModel> spuareList = new List();
    spuareList.add(new SpuareTypeModel(
        title: '美食',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '自由行',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '榜单',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '定制旅游',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '定制旅游',
        urlPath: 'statistics/destination_map_search_result_type_scene',
        currentIndex: 0));
    sumspuareList.add(spuareList);
  }

  //Widget头部
  Widget widgetHeader() {
    return Container(
      child: Stack(
        children: <Widget>[
          LoadImage(
            'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573803479&di=241850ac9a0ec31e6ba1f83651512416&imgtype=jpg&er=1&src=http%3A%2F%2Ffile112.mafengwo.net%2Fs7%2FM00%2F23%2FEA%2FwKgB6lPeZ0-Ad7CxAAmRB-9zrMk61.jpeg',
            width: ScreenUtil().setWidth(750),
            height: ScreenUtil().setHeight(300.0),
            fit: BoxFit.contain,
          ),
          Positioned(
              left: 30.0,
              top: ScreenUtil().setHeight(50.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Text(
                    '西安',
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 18.0,
                        fontWeight: FontWeight.bold),
                  ),
                  Gaps.vGap5,
                  Text('XIAN',
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 18.0,
                          fontWeight: FontWeight.bold)),
                  Gaps.vGap5,
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.cloud,
                        color: Colors.white,
                      ),
                      Gaps.hGap10,
                      Text('8~17℃',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 18.0,
                              fontWeight: FontWeight.bold))
                    ],
                  )
                ],
              )),
        ],
      ),
    );
  }

  //城市灵感假数据
  List<SpuareTypeModel> getspuareCityList(){
   spuareCityList = new List();
    spuareCityList.add(new SpuareTypeModel(title: '西安玩乐人气榜',urlPath:'statistics/ic_item_tourism_bg',subContent:'双十一囤货季' ));
    spuareCityList.add(new SpuareTypeModel(title: '玩转西安必知道',urlPath:'statistics/ic_item_tourism2_bg' ,subContent:'登上古老城墙'));
    spuareCityList.add(new SpuareTypeModel(title: '长安十二时辰',urlPath:'statistics/ic_item_tourism3_bg' ,subContent:'超然热剧玩转长安'));
   spuareCityList.add(new SpuareTypeModel(title: '去看兵马俑',urlPath:'statistics/ic_item_tourism4_bg' ,subContent:'品尝三秦美食'));
   spuareCityList.add(new SpuareTypeModel(title: '地道陕西菜',urlPath:'statistics/ic_item_tourism5_bg',subContent:'世界八大奇迹'));
  }

  //当地必玩title
  List<NavigationModel> getNavigationList(){
    navigationList=new List();
    navigationList.add(new NavigationModel(title: '美景'));
    navigationList.add(new NavigationModel(title: '美食'));
    navigationList.add(new NavigationModel(title: '酒店'));
    navigationList.add(new NavigationModel(title: '购物'));
  }
}
